Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pug-lexer

Package Overview
Dependencies
Maintainers
2
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pug-lexer

The pug lexer (takes a string and converts it to an array of tokens)

  • 3.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5M
increased by3.27%
Maintainers
2
Weekly downloads
 
Created

What is pug-lexer?

The pug-lexer npm package is a lexer for the Pug templating language. It tokenizes Pug source code into a stream of tokens that can be used for further processing, such as parsing or compiling into HTML.

What are pug-lexer's main functionalities?

Tokenizing Pug Source Code

This feature allows you to tokenize Pug source code. The code sample demonstrates how to use the pug-lexer to convert a simple Pug template into a stream of tokens.

const lexer = require('pug-lexer');
const tokens = lexer('p
  | Hello, World!');
console.log(tokens);

Handling Indentation

This feature handles the indentation in Pug templates. The code sample shows how nested elements are tokenized, preserving the hierarchical structure.

const lexer = require('pug-lexer');
const tokens = lexer('div
  p Hello
    span World');
console.log(tokens);

Custom Filters

This feature supports custom filters in Pug templates. The code sample demonstrates how a custom filter like 'markdown' is tokenized.

const lexer = require('pug-lexer');
const tokens = lexer('p: markdown
  **Hello, World!**');
console.log(tokens);

Other packages similar to pug-lexer

Keywords

FAQs

Package last updated on 18 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc